package com.mit.web.business.proxy
{
	import com.mit.web.business.remote.BaseService;
	import com.mit.web.business.remote.IInvokeResponder;
	import com.mit.web.config.Constants;
	import com.mit.web.config.DisplayConfiguration;
	
	import mx.collections.ArrayCollection;
	
	public class InventoryProxy extends BaseService
	{
		private static var me:InventoryProxy;

		
		public function InventoryProxy()
		{
			super(Constants.REMOTE_OBJECT_INVENTORY);
			if(me != null)
				throw new Error("Only one instance of this class is allowed, use getInstance() insteadof the constructor.");

		}
		
		public static function getInstance():InventoryProxy{
			if(me == null)
				me = new InventoryProxy();
			return me;
		} 
		
		public function getWarehouses():IInvokeResponder{
			return invoke("retrieveWarehouses");
		}
		
		public function saveWarehouses(w:ArrayCollection):IInvokeResponder{
			return invoke("saveWarehouses", w);
		}
		
		public function getWarehouseBasicInfo():IInvokeResponder{
			return invoke("retrieveWarehouseBasicInfo");
		}	
		
		public function getPagedMaterialReceivedNotes(pageNo:int, poCode:String = null, code:String=null, supplierId:int=0, dateFrom:Date=null, dateTo:Date=null, state:String = null):IInvokeResponder{
			return invoke("retrievePagedMaterialReceivedNotes", poCode, code, supplierId,dateFrom, dateTo, state, pageNo, DisplayConfiguration.getInstance().PAGE_SIZE);
		}
		
		public function getMaterialReceivedNoteCount( poCode:String = null,code:String=null, supplierId:int=0, dateFrom:Date=null, dateTo:Date=null, state:String = null):IInvokeResponder{
			return invoke("retrieveMaterialReceivedNoteCount", poCode, code, supplierId,dateFrom, dateTo, state);
		}
		
		public function getPendingReceiveMaterial(supplierId:int):IInvokeResponder{
			return invoke("retrievePendingReceiveMaterial",supplierId);
		}
	}
}